.class public Lcom/zuimeia/ui/utils/MutilClickUtil;
.super Ljava/lang/Object;
.source "MutilClickUtil.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;
    }
.end annotation


# instance fields
.field private mCanPerformClick:Z

.field private mCanPerformMutilClick:Z

.field private mCanPerformSingleClick:Z

.field private mCurPoint:Landroid/graphics/PointF;

.field private mCurRepeatTimes:I

.field private mDelayTask:Ljava/lang/Runnable;

.field private mDownPoint:Landroid/graphics/PointF;

.field private mEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

.field private mHandler:Landroid/os/Handler;

.field private mLastClickPotint:Landroid/graphics/PointF;

.field private mLongClickEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

.field private mLongPressTask:Ljava/lang/Runnable;

.field private mLongPressTimeout:I

.field private mRepeatDelay:I

.field private mRepeatTimeout:I

.field private mSingleClickEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

.field private mTargetTimes:I

.field private mTimeOutTask:Ljava/lang/Runnable;

.field private mTouchSlop:F


# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;I)V
    .registers 7
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "event"    # Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;
    .param p3, "targetTimes"    # I

    .prologue
    .line 34
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 133
    new-instance v0, Lcom/zuimeia/ui/utils/MutilClickUtil$1;

    invoke-direct {v0, p0}, Lcom/zuimeia/ui/utils/MutilClickUtil$1;-><init>(Lcom/zuimeia/ui/utils/MutilClickUtil;)V

    iput-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLongPressTask:Ljava/lang/Runnable;

    .line 144
    new-instance v0, Lcom/zuimeia/ui/utils/MutilClickUtil$2;

    invoke-direct {v0, p0}, Lcom/zuimeia/ui/utils/MutilClickUtil$2;-><init>(Lcom/zuimeia/ui/utils/MutilClickUtil;)V

    iput-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mDelayTask:Ljava/lang/Runnable;

    .line 152
    new-instance v0, Lcom/zuimeia/ui/utils/MutilClickUtil$3;

    invoke-direct {v0, p0}, Lcom/zuimeia/ui/utils/MutilClickUtil$3;-><init>(Lcom/zuimeia/ui/utils/MutilClickUtil;)V

    iput-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mTimeOutTask:Ljava/lang/Runnable;

    .line 35
    iput-object p2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

    .line 36
    iput p3, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mTargetTimes:I

    .line 37
    invoke-static {}, Landroid/view/ViewConfiguration;->getKeyRepeatDelay()I

    move-result v0

    iput v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mRepeatDelay:I

    .line 38
    invoke-static {}, Landroid/view/ViewConfiguration;->getDoubleTapTimeout()I

    move-result v0

    iput v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mRepeatTimeout:I

    .line 39
    invoke-static {}, Landroid/view/ViewConfiguration;->getLongPressTimeout()I

    move-result v0

    iput v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLongPressTimeout:I

    .line 40
    const/4 v0, 0x1

    const/high16 v1, 0x41c80000

    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    invoke-virtual {v2}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v2

    invoke-static {v0, v1, v2}, Landroid/util/TypedValue;->applyDimension(IFLandroid/util/DisplayMetrics;)F

    move-result v0

    iput v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mTouchSlop:F

    .line 42
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mHandler:Landroid/os/Handler;

    .line 43
    return-void
.end method

.method static synthetic access$002(Lcom/zuimeia/ui/utils/MutilClickUtil;Z)Z
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/utils/MutilClickUtil;
    .param p1, "x1"    # Z

    .prologue
    .line 11
    iput-boolean p1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformSingleClick:Z

    return p1
.end method

.method static synthetic access$100(Lcom/zuimeia/ui/utils/MutilClickUtil;)Z
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/utils/MutilClickUtil;

    .prologue
    .line 11
    iget-boolean v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformClick:Z

    return v0
.end method

.method static synthetic access$200(Lcom/zuimeia/ui/utils/MutilClickUtil;)Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/utils/MutilClickUtil;

    .prologue
    .line 11
    iget-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLongClickEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

    return-object v0
.end method

.method static synthetic access$300(Lcom/zuimeia/ui/utils/MutilClickUtil;)Landroid/graphics/PointF;
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/utils/MutilClickUtil;

    .prologue
    .line 11
    iget-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mDownPoint:Landroid/graphics/PointF;

    return-object v0
.end method

.method static synthetic access$402(Lcom/zuimeia/ui/utils/MutilClickUtil;Z)Z
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/utils/MutilClickUtil;
    .param p1, "x1"    # Z

    .prologue
    .line 11
    iput-boolean p1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformMutilClick:Z

    return p1
.end method

.method static synthetic access$500(Lcom/zuimeia/ui/utils/MutilClickUtil;)I
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/utils/MutilClickUtil;

    .prologue
    .line 11
    iget v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurRepeatTimes:I

    return v0
.end method

.method static synthetic access$502(Lcom/zuimeia/ui/utils/MutilClickUtil;I)I
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/utils/MutilClickUtil;
    .param p1, "x1"    # I

    .prologue
    .line 11
    iput p1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurRepeatTimes:I

    return p1
.end method

.method static synthetic access$602(Lcom/zuimeia/ui/utils/MutilClickUtil;Landroid/graphics/PointF;)Landroid/graphics/PointF;
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/utils/MutilClickUtil;
    .param p1, "x1"    # Landroid/graphics/PointF;

    .prologue
    .line 11
    iput-object p1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurPoint:Landroid/graphics/PointF;

    return-object p1
.end method

.method static synthetic access$700(Lcom/zuimeia/ui/utils/MutilClickUtil;)Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/utils/MutilClickUtil;

    .prologue
    .line 11
    iget-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mSingleClickEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

    return-object v0
.end method

.method private onClick()V
    .registers 7

    .prologue
    .line 95
    iget v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurRepeatTimes:I

    if-nez v1, :cond_2a

    .line 96
    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mHandler:Landroid/os/Handler;

    iget-object v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mDelayTask:Ljava/lang/Runnable;

    invoke-virtual {v1, v2}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 97
    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mHandler:Landroid/os/Handler;

    iget-object v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mTimeOutTask:Ljava/lang/Runnable;

    invoke-virtual {v1, v2}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 99
    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mHandler:Landroid/os/Handler;

    iget-object v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mDelayTask:Ljava/lang/Runnable;

    iget v3, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mRepeatDelay:I

    int-to-long v4, v3

    invoke-virtual {v1, v2, v4, v5}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 100
    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mHandler:Landroid/os/Handler;

    iget-object v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mTimeOutTask:Ljava/lang/Runnable;

    iget v3, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mRepeatTimeout:I

    int-to-long v4, v3

    invoke-virtual {v1, v2, v4, v5}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 102
    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurPoint:Landroid/graphics/PointF;

    iput-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLastClickPotint:Landroid/graphics/PointF;

    .line 105
    :cond_2a
    iget v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurRepeatTimes:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurRepeatTimes:I

    .line 106
    iget v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurRepeatTimes:I

    iget v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mTargetTimes:I

    if-ne v1, v2, :cond_5e

    iget-boolean v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformMutilClick:Z

    if-eqz v1, :cond_5e

    .line 107
    const/4 v0, 0x1

    .line 108
    .local v0, "samePoint":Z
    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLastClickPotint:Landroid/graphics/PointF;

    if-eqz v1, :cond_4b

    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurPoint:Landroid/graphics/PointF;

    if-eqz v1, :cond_4b

    .line 109
    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurPoint:Landroid/graphics/PointF;

    iget-object v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLastClickPotint:Landroid/graphics/PointF;

    invoke-direct {p0, v1, v2}, Lcom/zuimeia/ui/utils/MutilClickUtil;->samePoint(Landroid/graphics/PointF;Landroid/graphics/PointF;)Z

    move-result v0

    .line 111
    :cond_4b
    if-eqz v0, :cond_5e

    .line 112
    const/4 v1, 0x0

    iput v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurRepeatTimes:I

    .line 113
    const/4 v1, 0x0

    iput-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurPoint:Landroid/graphics/PointF;

    .line 114
    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

    if-eqz v1, :cond_5e

    .line 115
    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

    iget-object v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mDownPoint:Landroid/graphics/PointF;

    invoke-interface {v1, v2}, Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;->performClickEvent(Landroid/graphics/PointF;)V

    .line 121
    .end local v0    # "samePoint":Z
    :cond_5e
    return-void
.end method

.method private samePoint(FFFF)Z
    .registers 13
    .param p1, "x1"    # F
    .param p2, "y1"    # F
    .param p3, "x2"    # F
    .param p4, "y2"    # F

    .prologue
    const-wide/high16 v6, 0x4000000000000000L

    .line 129
    sub-float v2, p3, p1

    float-to-double v2, v2

    invoke-static {v2, v3, v6, v7}, Ljava/lang/Math;->pow(DD)D

    move-result-wide v2

    sub-float v4, p4, p2

    float-to-double v4, v4

    invoke-static {v4, v5, v6, v7}, Ljava/lang/Math;->pow(DD)D

    move-result-wide v4

    add-double/2addr v2, v4

    invoke-static {v2, v3}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v0

    .line 130
    .local v0, "distance":D
    iget v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mTouchSlop:F

    float-to-double v2, v2

    cmpg-double v2, v0, v2

    if-gez v2, :cond_1e

    const/4 v2, 0x1

    :goto_1d
    return v2

    :cond_1e
    const/4 v2, 0x0

    goto :goto_1d
.end method

.method private samePoint(Landroid/graphics/PointF;Landroid/graphics/PointF;)Z
    .registers 11
    .param p1, "f1"    # Landroid/graphics/PointF;
    .param p2, "f2"    # Landroid/graphics/PointF;

    .prologue
    const-wide/high16 v6, 0x4000000000000000L

    .line 124
    iget v2, p2, Landroid/graphics/PointF;->x:F

    iget v3, p1, Landroid/graphics/PointF;->x:F

    sub-float/2addr v2, v3

    float-to-double v2, v2

    invoke-static {v2, v3, v6, v7}, Ljava/lang/Math;->pow(DD)D

    move-result-wide v2

    iget v4, p2, Landroid/graphics/PointF;->y:F

    iget v5, p1, Landroid/graphics/PointF;->y:F

    sub-float/2addr v4, v5

    float-to-double v4, v4

    invoke-static {v4, v5, v6, v7}, Ljava/lang/Math;->pow(DD)D

    move-result-wide v4

    add-double/2addr v2, v4

    invoke-static {v2, v3}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v0

    .line 125
    .local v0, "distance":D
    iget v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mTouchSlop:F

    float-to-double v2, v2

    cmpg-double v2, v0, v2

    if-gez v2, :cond_24

    const/4 v2, 0x1

    :goto_23
    return v2

    :cond_24
    const/4 v2, 0x0

    goto :goto_23
.end method


# virtual methods
.method public onEvent(Landroid/view/MotionEvent;)V
    .registers 7
    .param p1, "event"    # Landroid/view/MotionEvent;

    .prologue
    const/4 v3, 0x1

    const/4 v4, 0x0

    .line 54
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v0

    packed-switch v0, :pswitch_data_7a

    .line 91
    :cond_9
    :goto_9
    return-void

    .line 57
    :pswitch_a
    new-instance v0, Landroid/graphics/PointF;

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v1

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v2

    invoke-direct {v0, v1, v2}, Landroid/graphics/PointF;-><init>(FF)V

    iput-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mDownPoint:Landroid/graphics/PointF;

    .line 58
    iput-boolean v3, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformClick:Z

    .line 59
    iput-boolean v3, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformSingleClick:Z

    .line 60
    iget-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLongPressTask:Ljava/lang/Runnable;

    iget v2, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLongPressTimeout:I

    int-to-long v2, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    goto :goto_9

    .line 64
    :pswitch_28
    iput-boolean v4, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformClick:Z

    .line 65
    iput-boolean v4, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformSingleClick:Z

    .line 66
    iget-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLongPressTask:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    goto :goto_9

    .line 70
    :pswitch_34
    iget-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLongPressTask:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 71
    iget-boolean v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformSingleClick:Z

    if-eqz v0, :cond_9

    .line 72
    new-instance v0, Landroid/graphics/PointF;

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v1

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v2

    invoke-direct {v0, v1, v2}, Landroid/graphics/PointF;-><init>(FF)V

    iput-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurPoint:Landroid/graphics/PointF;

    .line 73
    iget-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mDownPoint:Landroid/graphics/PointF;

    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCurPoint:Landroid/graphics/PointF;

    invoke-direct {p0, v0, v1}, Lcom/zuimeia/ui/utils/MutilClickUtil;->samePoint(Landroid/graphics/PointF;Landroid/graphics/PointF;)Z

    move-result v0

    if-eqz v0, :cond_9

    .line 74
    invoke-direct {p0}, Lcom/zuimeia/ui/utils/MutilClickUtil;->onClick()V

    goto :goto_9

    .line 81
    :pswitch_5c
    iget-boolean v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformClick:Z

    if-eqz v0, :cond_9

    iget-object v0, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mDownPoint:Landroid/graphics/PointF;

    iget v0, v0, Landroid/graphics/PointF;->x:F

    iget-object v1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mDownPoint:Landroid/graphics/PointF;

    iget v1, v1, Landroid/graphics/PointF;->y:F

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v2

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v3

    invoke-direct {p0, v0, v1, v2, v3}, Lcom/zuimeia/ui/utils/MutilClickUtil;->samePoint(FFFF)Z

    move-result v0

    if-nez v0, :cond_9

    .line 82
    iput-boolean v4, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mCanPerformClick:Z

    goto :goto_9

    .line 54
    nop

    :pswitch_data_7a
    .packed-switch 0x0
        :pswitch_a
        :pswitch_34
        :pswitch_5c
        :pswitch_28
    .end packed-switch
.end method

.method public setOnLongClickEvent(Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;)V
    .registers 2
    .param p1, "event"    # Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

    .prologue
    .line 50
    iput-object p1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mLongClickEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

    .line 51
    return-void
.end method

.method public setOnSingleClickEvent(Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;)V
    .registers 2
    .param p1, "event"    # Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

    .prologue
    .line 46
    iput-object p1, p0, Lcom/zuimeia/ui/utils/MutilClickUtil;->mSingleClickEvent:Lcom/zuimeia/ui/utils/MutilClickUtil$ClickEvent;

    .line 47
    return-void
.end method
